package widget.common.tools
{
	import flash.display.Loader;
	import flash.display.MovieClip;
	import flash.events.Event;
	
	import widget.common.event.LoadDataEvent;
	
	
	public class AnimationLoader extends DisplayLoader
	{
		private var animation:MovieClip = null;
		public function AnimationLoader()
		{
			super();
		}
		
		override protected function completeHandler(event : Event) : void
		{
			super.completeHandler(event);
			var load : Loader = Loader(event.currentTarget.loader);
			// var byteArray:ByteArray = load.contentLoaderInfo.bytes;
			// byteArray.position = 0;
			var mc : MovieClip = load.content as MovieClip;
			animation = mc;
			this.dispatchEvent(new LoadDataEvent(LoadDataEvent.COMPLETE_LOADER , mc));
		}

		public function getAnimation():MovieClip{
			return animation;
		}

		override public function loadByURL(url : String) : void
		{
			loadURL = url;
			load();
		}

		override public function clear() : void
		{
			super.clear();
			animation = null;
		}
	}
}